﻿<%@ Page Title="" Language="C#" MasterPageFile="~/SiteMaster.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Web.Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <script>
        function ClearStartPoint() {
            $("#<%= hdnValueStartPoint.ClientID %>").val('');
            $("#<%= txtStartPoint.ClientID %>").val('');
        }

        function ClearEndPoint() {
            $("#<%= hdnValueEndPoint.ClientID %>").val('');
            $("#<%= txtEndPoint.ClientID %>").val('');
        }

        function OnSelectedStartPoint(source, eventArgs) {
            $("#<%= hdnValueStartPoint.ClientID %>").val(eventArgs.get_value()).trigger('change');
        }

        function OnSelectedEndPoint(source, eventArgs) {
            $("#<%= hdnValueEndPoint.ClientID %>").val(eventArgs.get_value()).trigger('change');
        }
    </script>
    <h3>Flight search</h3>
    <table>
        <tr>
            <td>
                <asp:RadioButton ID="rdbOneWay" runat="server" Text="One way" GroupName="GroupItineraryType" Checked="true" />
                <asp:RadioButton ID="rdbRoundTrip" runat="server" Text="Round trip" GroupName="GroupItineraryType" Checked="false" />
            </td>
            <td></td>
        </tr>
        <tr>
            <td>Departure</td>
            <td>Destination</td>
        </tr>
        <tr>
            <td>
                <input type="hidden" id="hdnValueStartPoint" value="" runat="server" />
                <asp:TextBox runat="server" ID="txtStartPoint" Width="200px" AutoComplete="off" onclick="ClearStartPoint()" />
                <asp:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteExStartPoint" ID="AutoCompleteStartPoint"
                    TargetControlID="txtStartPoint" ServicePath="SearchCity.asmx" ServiceMethod="GetCompletionList"
                    MinimumPrefixLength="2" CompletionInterval="0" EnableCaching="false" CompletionSetCount="10"
                    CompletionListCssClass="autocomplete_completionListElement" 
                    CompletionListItemCssClass="autocomplete_listItem"
                    CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :"
                    ShowOnlyCurrentWordInCompletionListItem="true" OnClientItemSelected="OnSelectedStartPoint">
                    <Animations>
                        <OnShow>
                            <Sequence>
                                <OpacityAction Opacity="0" />
                                <HideAction Visible="true" />                                            
                                <Parallel Duration="0.2">
                                    <FadeIn />
                                    <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteExStartPoint')._height" />
                                </Parallel>
                            </Sequence>
                        </OnShow>
                        <OnHide>                                    
                            <Sequence>
                                <ScriptAction Script="onHideAutocompleteStartPoint();" />
                                <Parallel Duration="0.2">
                                    <FadeOut />
                                    <Length PropertyKey="height" StartValueScript="$find('AutoCompleteExStartPoint')._height" EndValue="0" />
                                </Parallel>
                            </Sequence>
                        </OnHide>
                    </Animations>
                </asp:AutoCompleteExtender>
            </td>
            <td>
                <input type="hidden" id="hdnValueEndPoint" value="" runat="server" />
                <asp:TextBox runat="server" ID="txtEndPoint" Width="200px" AutoComplete="off" onclick="ClearEndPoint()" />
                <asp:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteExEndPoint" ID="AutoCompleteEndPoint"
                    TargetControlID="txtEndPoint" ServicePath="SearchCity.asmx" ServiceMethod="GetCompletionList"
                    MinimumPrefixLength="2" CompletionInterval="0" EnableCaching="false" CompletionSetCount="10"
                    CompletionListCssClass="autocomplete_completionListElement" 
                    CompletionListItemCssClass="autocomplete_listItem"
                    CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" DelimiterCharacters=";, :"
                    ShowOnlyCurrentWordInCompletionListItem="true" OnClientItemSelected="OnSelectedEndPoint">
                    <Animations>
                        <OnShow>
                            <Sequence>
                                <OpacityAction Opacity="0" />
                                <HideAction Visible="true" />
                                <Parallel Duration="0.2">
                                    <FadeIn />
                                    <Length PropertyKey="height" StartValue="0" EndValueScript="$find('AutoCompleteExEndPoint')._height" />
                                </Parallel>
                            </Sequence>
                        </OnShow>
                        <OnHide>
                            <Sequence>
                                <Parallel Duration="0.2">
                                    <FadeOut />
                                    <Length PropertyKey="height" StartValueScript="$find('AutoCompleteExEndPoint')._height" EndValue="0" />
                                </Parallel>
                            </Sequence>
                        </OnHide>
                    </Animations>
                </asp:AutoCompleteExtender>
            </td>
        </tr>
        <tr>
            <td>Departure date</td>
            <td>Destination date</td>
        </tr>
        <tr>
            <td><asp:TextBox ID="txtDepartureDate" runat="server"></asp:TextBox></td>
            <td><asp:TextBox ID="txtReturnDate" runat="server"></asp:TextBox></td>
        </tr>
        <tr>
            <td>
                Adult
                <asp:DropDownList ID="ddlAdt" runat="server">
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td></td>
        </tr>
        <tr>
            <td>
                Child
                <asp:DropDownList ID="ddlChd" runat="server">
                    <asp:ListItem>0</asp:ListItem>
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td></td>
        </tr>
        <tr>
            <td>
                Infant
                <asp:DropDownList ID="ddlInf" runat="server">
                    <asp:ListItem>0</asp:ListItem>
                    <asp:ListItem>1</asp:ListItem>
                    <asp:ListItem>2</asp:ListItem>
                    <asp:ListItem>3</asp:ListItem>
                    <asp:ListItem>4</asp:ListItem>
                    <asp:ListItem>5</asp:ListItem>
                </asp:DropDownList>
            </td>
            <td></td>
        </tr>
    </table>
    <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
</asp:Content>
